<script>
export default {
  name: 'menu'
}
</script>
<script setup>
import Search from '@/views/system/menu/cpns/search.vue'
import Content from '@/views/system/menu/cpns/content.vue'
import { ref } from 'vue'
import useMenuStore from '@/store/menu/index.js'
import MenuDialog from '@/views/system/menu/cpns/menu-dialog.vue'

//获取角色数据
const page = ref(1)
const size = ref(10)
const menuStore = useMenuStore()

//条件查询信息
const searchParamsBtnEmits = (searchParams) => {
  menuStore.getMenuTreeAction(searchParams)
}

//重置参数搜索用户
const resetParamsBtnEmits = () => {
  menuStore.getRoleListAction(page.value, size.value)
}

//弹出框实列
const dialogRef = ref()

//接收content传递过来的事件
const dialogVisibleEmits = (value) => {
  dialogRef.value.dialogVisible = value
  //新增
  dialogRef.value.isNewOrUpdate = true
}

//修改
const dialogUpdateVisibleEmits = (value, row) => {
  dialogRef.value.dialogVisible = value
  //修改
  dialogRef.value.isNewOrUpdate = false
  dialogRef.value.dialogEditInfoBtn(row)
}
</script>

<template>
  <div class="role">
    <search
      @search-params-btn-emits="searchParamsBtnEmits"
      @reset-params-btn-emits="resetParamsBtnEmits"
    />
    <content
      @dialog-visible-emits="dialogVisibleEmits"
      @dialog-update-visible-emits="dialogUpdateVisibleEmits"
      :menu-list="menuStore.menuTree"
    />
    <menu-dialog ref="dialogRef" />
  </div>
</template>

<style scoped lang="less"></style>
